/**
 * 
 */
package cn.softTank.BpelModelImpl;

import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import cn.softTank.BpelModel.ToPart;
import cn.softTank.BpelModel.Variable;

/**
 * @author Yuzone (smartzxy@gmail.com)
 * 
 */
public class ToPartImpl implements ToPart {

	private String part;
	private Variable fromVariable;

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.ToPart#getFromVariable()
	 */
	@Override
	public Variable getFromVariable() {
		return fromVariable;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.ToPart#getPart()
	 */
	@Override
	public String getPart() {
		return part;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * cn.softTank.BpelModel.ToPart#setFromVariable(cn.softTank.BpelModel.Variable
	 * )
	 */
	@Override
	public void setFromVariable(Variable value) {
		fromVariable = value;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.ToPart#setPart(java.lang.String)
	 */
	@Override
	public void setPart(String value) {
		part = value;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.XmlAdapt#toElement()
	 */
	@Override
	public Element toElement() {
		Element e = DocumentHelper.createElement("toPart");
		if (part != null)
			e.addAttribute("part", part);
		if (fromVariable != null)
			e.addAttribute("fromVariable", fromVariable.getName());
		return e;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cn.softTank.BpelModel.XmlAdapt#toXml()
	 */
	@Override
	public String toXml() {
		// TODO Auto-generated method stub
		return null;
	}

}
